#include "stdafx.h"

using namespace NLog;
using namespace NLog::Config;

int main(array<System::String ^> ^args)
{
    // Initialize Logger
    LogManager::Configuration = gcnew XmlLoggingConfiguration("NLog.config");

    // Create a window
    Window^ myWindow = gcnew Window("Handbanana", Coordinates::Rectangle(50, 50, 512, 512));

    // Initialize the game engine
    Engine::Initialize(myWindow);

    // Start the game engine
    Engine::Start();

    // Enter the message loop
    MSG msg;
    while(::GetMessage(&msg, NULL, 0, 0) > 0)
    {
        ::TranslateMessage(&msg);
        ::DispatchMessage(&msg);

        if (Engine::QuitFlag)
        {
            ::PostQuitMessage(0);
        }
    }

    // Stop the engine after the window is destroyed
    Engine::Stop();

    return 0;
}